package com.richest.api.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.richest.api.dao.PayCallBackMapper;
import com.richest.api.service.IPayCallBackService;
import com.richest.bean.PayCallBackBean;

/**
 * 
 * @author zhaohongchao 2019年3月20日 下午2:58:04
 * @email 70375739@qq.com
 */
@Service
public class PayCallBackServiceImpl implements IPayCallBackService {
	@Autowired
	private PayCallBackMapper payCallBackMapper;

	@Override
	public PayCallBackBean findAllByOutTradeNo(String strTransactionId) {
		return payCallBackMapper.findAllByOutTradeNo(strTransactionId);
	}

	@Override
	public void insert(PayCallBackBean payCallBackBean) {
		payCallBackMapper.insert(payCallBackBean);
	}

	@Override
	public void insertOrUpdate(PayCallBackBean payCallBackBean) {
		PayCallBackBean tmpBean = payCallBackMapper.selectById(payCallBackBean.getId());
		if (null == tmpBean) {
			payCallBackMapper.insert(payCallBackBean);
		} else {
			payCallBackMapper.update(payCallBackBean);
		}
	}
}
